package net.lainiao.workflow.shiro;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2017/1/19.
 */
@Component
public class SuperUser {
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Value("${super.username}")
    private String username;

    @Value("${super.password}")
    private String password;

    public boolean isAdmin(String uname, String pwd) {
        if (StringUtils.isBlank(uname) || StringUtils.isBlank(pwd)) {
            return false;
        }
        if (this.username.equals(uname) && this.password.equals(pwd)) {
            return true;
        }
        return false;
    }
}
